package footballtest;

public class Person {
	
	long coins = 25000;
	
	/**
	 * 放入n个硬币到赌博机中
	 * @param n 	放入硬币数
	 * @param gb 	赌博机
	 * @return 		输赢情况:true 赢 false:输
	 */
	public boolean putInTo(long n, Gamble gb) {
		this.coins -= n;
		long retu = gb.putIn(n);
		this.coins += retu;
		return retu == 0 ? false : true;
	}
	
	@Override
	public String toString() {
		return "当前人物拥有金钱数:" + this.coins + "元";
	}

	/**
	 * 踢球
	 * 玩大false :100 元宝
	 * 玩小true  :20   元宝
	 */
	public boolean playBall ( boolean b ) {
		boolean isWin = Util.isHappen( 0.5f );
		if(b){
			coins += isWin ? 20 : -20;
		} else {
			coins += isWin ? 100 : -100;
		}
		return isWin;
	}
}
